import { api } from '@/utils/request'
import type { Goal, CreateGoalRequest, UpdateGoalRequest } from '@/types/goal'

// 获取所有目标
export const getGoals = () => {
  return api.get<Goal[]>('/goals')
}

// 创建目标
export const createGoal = (data: CreateGoalRequest) => {
  return api.post<Goal>('/goals', data)
}

// 更新目标
export const updateGoal = (id: number, data: UpdateGoalRequest) => {
  return api.put<Goal>(`/goals/${id}`, data)
}

// 删除目标
export const deleteGoal = (id: number) => {
  return api.delete(`/goals/${id}`)
}
